package com.demo.es.service;

import com.demo.es.common.Page;
import com.demo.es.pojo.dto.UserDTO;
import com.demo.es.pojo.request.QueyUserRequest;
import com.demo.es.pojo.response.PageInfoResponse;

import java.io.IOException;
import java.util.List;

/**
 * @author 李炯
 * @description: DOTO
 * @program: elastic-demo
 * @date 2020/06/01
 **/
public interface ElasticSearchService {
    /**
     * 高级客户端用法 should使用
     * select * from goods where goodsType = "" or (goodsName = "" and address ="贵州" and price = "")
     */
    PageInfoResponse<List<UserDTO>> queryHighClientSearch(Page<QueyUserRequest> userRequest) throws IOException;

    /**
     * 计算每个商品类型分组后的最高的价格
     * select goodsType, max(price) from goods group by goodsType
     */
    public PageInfoResponse<List<UserDTO>> queryHighUserList(Page<QueyUserRequest> userRequest) throws IOException;

    /**
     * 无查询条件根据商品类型分组,求每组平均avg金额,并分组里按照price排序,sum和 max最大 min最小值同理
     * select goodsType, avg(price) from goods group by goodsType order by price asc
     */
    public PageInfoResponse<List<UserDTO>> queryAvgUserList(Page<QueyUserRequest> userRequest) throws IOException;

    /**
     * 高级客户端查询
     * select * from goods where goodsType like '%手机%' 搜索到的条件过滤掉 goodsName字段 不含带 "华为的"关键词
     */
    PageInfoResponse<List<UserDTO>> queryHighClient(Page<QueyUserRequest> userRequest) throws IOException;

}
